﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


using zsi.Framework.Data.DataProvider.SQLServer;
using zsi.Framework.Data;
using zsi.phgov.Models;
using System.Data;
using System.Data.SqlClient;
using zsi.phgov.Util;
namespace zsi.phgov.Models.DataControllers
{
    public class dcProvince : MasterDataController<Province>
    {
        public override void InitDataController()
        {
            this.DBConn = new SqlConnection(DBConnection.ConnectionString);
            this.Procedures.Add(new Procedure("dbo.SelectProvince", SQLCommandType.GetSingleInfo));
            this.Procedures.Add(new Procedure("dbo.SelectProvince", SQLCommandType.Select));
            this.Procedures.Add(new Procedure("dbo.UpdatePlace", SQLCommandType.Update));
        }

        public List<Province> GetProvinceList(int RegionId)
        {
            Procedure p = new Procedure("SelectProvince");
            p.Parameters.Add("p_RegionId", RegionId.ToString());
            p.Parameters.Add("p_IsDDL", 1);
            return new dcProvince().GetDataSource(p);
        }
        public Province GetProvinceInfo(Object ProvinceId)
        {
            try
            {
                int _ProvinceId = Convert.ToInt32(ProvinceId);
                this.SelectInfoParameters.Add("p_ProvinceId", _ProvinceId);
                return this.GetInfo();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }


}
